package com.chaoxinet.csmall.passport.service.impl;

import com.chaoxinet.csmall.passport.mapper.RoleMapper;
import com.chaoxinet.csmall.passport.pojo.vo.RoleListVO;
import com.chaoxinet.csmall.passport.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Iterator;
import java.util.List;

/**
 * @Name: RoleServiceImpl
 * @Author: 西风残叶
 * @Company: 朝兮网络工作室
 * @Date: 2024/2/14 14:16
 * @TODO: 处理角色相关业务逻辑的实现类
 */
@Slf4j
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    /**
     * 查询角色列表
     *
     * @return 列表数据
     */
    @Override
    public List<RoleListVO> list() {
        log.debug("开始处理[查询角色列表]的业务,无参数");
        List<RoleListVO> list = roleMapper.list();
        Iterator<RoleListVO> iterator = list.iterator();
        while (iterator.hasNext()) {
            RoleListVO roleListVO = iterator.next();
           if (roleListVO.getId() == 1){
               iterator.remove();
               break;
           }
        }
        return list;
    }
}